package com.xialj.demoend.entity;

import com.alibaba.druid.sql.visitor.functions.Insert;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import java.util.Date;

/**
 * @Author xlj
 * @Date Created in  2023/3/16 17:19
 * @DESCRIPTION:
 * @Version V1.0
 */
@Data
public class UserExport {
   private static final long serialVersionUID = 2L;

   /**
    * id
    */
   private String id;

   /**
    * 用户名
    */
   private String username;

   /**
    * 昵称
    */
   private String nickname;

   /**
    * 邮箱
    */
   @ApiModelProperty(value = "联系人邮箱")
   @NotBlank(message = "邮箱不能为空", groups = {Insert.class})
   @NotNull(message = "邮箱不能为空", groups = {Insert.class})
   @Pattern(regexp = ".+@.+\\.com$", message = "Email格式不正确")
   private String email;

   /**
    * 电话
    */
   @ApiModelProperty(value = "联系人电话")
   @NotBlank(message = "手机号码不能为空", groups = {Insert.class})
   @NotNull(message = "手机号不能为空", groups = {Insert.class})
   @Length(min = 11, max = 11, message = "手机号只能为11位")
   @Pattern(regexp = "^[1][3,4,5,6,7,8,9][0-9]{9}$", message = "手机号格式有误")
   private String phone;

   /**
    * 地址
    */
   private String address;

   /**
    * 创建时间
    */
   @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
   private Date createTime;
   /**
    * 头像
    */
   private String avatarUrl;
}
